package com.bj58.zcm.scala.chapter01

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by liuwei54 on 2018/5/27.
  */
object SparkWorldCount {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("SparkWorldCount").setMaster("local[4]")
    val sc = new SparkContext(conf)
    val line = sc.textFile("doc/md/环境搭建.md")
    line.flatMap(_.split(" ")).map((_, 1)).reduceByKey(_+_).collect().foreach(println)
    sc.stop()
  }
}
